package com.jjz.id.config;

import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ZJL
 * @create 2025-05-28-9:34
 * 为 Jackson 注册 JavaTimeModule 模块，让 LocalDateTime 等 Java 8 时间类型能正确地序列化/反序列化为 JSON。
 */
@Configuration
public class JacksonConfiguration {
    @Bean
    public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
        return (builder) -> {
            builder.modulesToInstall(new Module[]{new JavaTimeModule()});
        };
    }
}
